#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TableCommonEffectDao:DaoBase<TableCommonEffect>
    {
        public override string GetFileName()
        {
            return "TableCommonEffect.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TableCommonEffect>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddPrimaryIndex(TableCommonEffect model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.effectId)) UnityEngine.Debug.LogError("数据表id重复:TableCommonEffect->id: " + model.effectId);
            #endif
            cachePrimaryInt[model.effectId] = model;
        }
        protected override TableCommonEffect ParseRowData(string[] rowData)
        {
            TableCommonEffect data = new TableCommonEffect();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.effectId = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.resourceUrl = rowData[1];
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.duration = float.Parse(rowData[2]);
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.isLoop = int.Parse(rowData[3]);
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.posX = float.Parse(rowData[4]);
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.posY = float.Parse(rowData[5]);
            }
            if (!string.IsNullOrEmpty(rowData[6]))
            {
                data.posZ = float.Parse(rowData[6]);
            }
            if (!string.IsNullOrEmpty(rowData[7]))
            {
                data.queueId = int.Parse(rowData[7]);
            }
            if (!string.IsNullOrEmpty(rowData[8]))
            {
                data.audio = rowData[8];
            }
            return data;
        }
    }
}
